class Page2 extends BaseScreen {
    public constructor() {
        super();
        this.skinName = "resource/eui_skins/Page2Skin.exml";
    }

    private img_1: eui.Image;
    private img_2: eui.Image;
    private img_3: eui.Image;
    private img_4: eui.Image;
    private img_5: eui.Image;

    private img_3_y: number = 0;
    private img_4_y: number = 0;
    private img_5_y: number = 0;
    private img_6_y: number = 0;
    private img_9_y:number = 0;
    private img_xx:eui.Image;
    protected childrenCreated(): void {
        super.childrenCreated();
        this.init_view();
    }

    public init_view() {
        this.page_mode = '';
        this.img_1.alpha = 0;
        this.anchorOff(this.img_2);
        this.anchorOff(this.img_3);
        this.anchorOff(this.img_4);
        this.anchorOff(this.img_5);

        this.resetui();
        this.showPage();
    }

    public resetui(){
        this.visible = true;
        this.img_1.alpha = 0;
        // this.img_1.x = -this.img_1.width;
        // this.img_2.x = -this.img_2.width*0.5;
        // this.img_3.x = -this.img_3.width;
        // this.img_4.x = -this.img_4.width;
        // this.img_5.x = -this.img_5.width;

        // this.img_xx.x = 0;
        // this.img_xx.scaleX = this.img_xx.scaleY = utils.CoreData.instance.xx_min;
        // this.img_xx.alpha = utils.CoreData.instance.xx_alpha;
        this.img_2.scaleX = this.img_2.scaleY = 0;
        this.img_3.scaleX = this.img_3.scaleY = 0;
        this.img_4.scaleX = this.img_4.scaleY = 0;
        this.img_5.scaleX = this.img_5.scaleY = 0;

       
        if(this.xx_page){
            this.xx_page.stop();
        }
    }

    public showPage() {
        
        egret.Tween.removeTweens(this);
        egret.Tween.removeTweens(this.img_2);
        egret.Tween.removeTweens(this.img_3);
        egret.Tween.removeTweens(this.img_4);
        egret.Tween.removeTweens(this.img_5);
        if (this.is_start_mv) {
            return;
        }
        this.is_start_mv = true;

        this.resetui();


        egret.Tween.get(this.img_1).wait(200).to({ alpha:1}, 2000);
        egret.Tween.get(this.img_2).wait(300).to({ "scaleX": 1,"scaleY":1 }, 800, egret.Ease.backOut);
        egret.Tween.get(this.img_3).wait(600).to({ "scaleX": 1,"scaleY":1 }, 800, egret.Ease.backOut);
        egret.Tween.get(this.img_4).wait(900).to({ "scaleX": 1,"scaleY":1 }, 800, egret.Ease.backOut);
        egret.Tween.get(this.img_5).wait(1200).to({ "scaleX": 1,"scaleY":1 }, 800, egret.Ease.backOut);
        // egret.Tween.get(this.img_xx,{loop:true}).to({ "x": 700}, 9000);
        // egret.Tween.get(this.img_xx,{loop:true}).to({ "scaleX":utils.CoreData.instance.xx_max,
        // "scaleY":utils.CoreData.instance.xx_max,"alpha":1}, 1500).to({ "scaleX":utils.CoreData.instance.xx_min,
        // "scaleY":utils.CoreData.instance.xx_min,"alpha":utils.CoreData.instance.xx_alpha}, 1500);
        // egret.Tween.get(this.img_3).wait(800).to({ "x": 0 }, 700, egret.Ease.backOut);
        // egret.Tween.get(this.img_4).wait(1300).to({ "x": 0 }, 700, egret.Ease.backOut);
        // egret.Tween.get(this.img_5).wait(1800).to({ "x": 0 }, 700, egret.Ease.backOut);
        if(this.xx_page){
            this.xx_page.start();
        }
    }

    public resize(): void {
        super.resize();
        this.rect_bg.height = this.height;
    }
}